package com.mm.ai.domain.po;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import lombok.Data;

/**
 * @BelongsProject: 8.mindmap
 * @BelongsPackage: com.mm.ai.domain.po
 * @Author : 游在海里的鱼
 * @CreateTime : 2024-05-18  00:05
 * @Version : 1.0
 * @ClassName : TODO
 * @Description : TODO
 */
@Data
public class Coze4Response {
    /*
    *  {
    * "messages":[{"role":"assistant","type":"answer","content":"你好！有什么可以帮到您的吗？","content_type":"text"},{"role":"assistant","type":"verbose","content":"{\"msg_type\":\"generate_answer_finish\",\"data\":\"\"}","content_type":"text"}],
    * "conversation_id":"123",
    * "code":0,
    * "msg":"success"}
     */

    private String messages;
    private String conversation_id;
    private String code;
    private String msg;

    public String getContent(){
        if(this.messages == null){
            return null;
        }
        JSONArray jsonArray = new JSONArray(this.messages);
        JSONObject jsonObject = jsonArray.getJSONObject(0);
        return jsonObject.getStr("content");
    }


}
